package karma.main;

import org.lwjgl.input.Keyboard;

import net.minecraft.client.Minecraft;
import net.minecraft.src.*;

public class ItemHolyBoots extends ItemArmor
{
    public static boolean allowJump;
    public static boolean allowNoFall;
    public static int damagetimer = 0;

    public ItemHolyBoots(int i, EnumArmorMaterial enumarmormaterial, int j, int k)
    {
        super(i, enumarmormaterial, j, k);
    }

    /**
     * Return an item rarity from EnumRarity
     */
    public EnumRarity getRarity(ItemStack itemstack)
    {
        return mod_KarmaCraft.ENCHANTED;
    }
    
    public static void checkIfWorn(Minecraft minecraft)
    {
        EntityPlayerSP entityplayersp = minecraft.thePlayer;

        if (minecraft.thePlayer.inventory.armorInventory[0] != null && minecraft.thePlayer.inventory.armorInventory[0].getItem() == mod_KarmaCraft.HolyBoots)
        {
            doSpecial(minecraft);
        }
    }
    
    public static void doSpecial(Minecraft mc)
    {
    	EntityPlayer entityplayer = mc.thePlayer;
    	if (entityplayer.fallDistance > 0)
    	{
    		entityplayer.fallDistance = 0;
    	}
    	if (entityplayer.motionY <= -0.1 && !entityplayer.isSneaking())
    	{
    		entityplayer.motionY = entityplayer.motionY / 2;
    		if (damagetimer == 0)
    		{
    			entityplayer.inventory.armorInventory[0].damageItem(1, entityplayer);
    			damagetimer = 60;
    		}
    	}
    	if (damagetimer > 0)
    	{
    		damagetimer --;
    	}
    	//mc.thePlayer.addChatMessage("" + entityplayer.motionY);
    }
}
